package com.game.server.message.proto.execute;

import com.comm.ISession;
import com.game.majiang.logic.LogicClient;
import com.game.majiang.logic.LogicServer;
import com.game.majiang.logic.LogicTable;
import com.game.majiang.logic.chexuan.ChexuanPlayer;
import com.game.server.message.proto.in.AbstractGamePlayerInfoReq;
import com.game.server.message.proto.out.GamePlayerInfoRsp;
import com.game.server.system.AbstractTable;

public class GamePlayerInfoReq extends AbstractGamePlayerInfoReq {

    @Override
    public void Execute(ISession session) {
        LogicClient client = (LogicClient) LogicServer.getInstance().getClient(session.getId());
        if (client != null&&client.checkClick(msgcode)) {
            AbstractTable abTable = client.getTable();
            if(abTable != null) {
            	LogicTable table = (LogicTable) abTable;
            	ChexuanPlayer player = (ChexuanPlayer) table.getPlayer(this.uid);
            	if(player != null) {
            		LogicClient clientTemp = (LogicClient) player.getClient();
            		GamePlayerInfoRsp rsp = new GamePlayerInfoRsp();
            		rsp.setUid(this.uid);
            		rsp.setZongjuCount(clientTemp.getVo().getZongjucount());
            		rsp.setZongshouCount(clientTemp.getVo().getZongshoucount());
            		rsp.setZongshouWinCount(clientTemp.getVo().getZongshouwincount());
            		rsp.setZupaiCount(clientTemp.getVo().getZupaicount());
            		rsp.setZupaiWinCount(clientTemp.getVo().getZupaiwincount());
            		client.Send(rsp);
            	}
            }
        }
    }

}
